
import TFrameResLoadHelper from "../helper/TFrameResLoadHelper";

const { ccclass, property, requireComponent } = cc._decorator;

@ccclass
@requireComponent(cc.Label)
export default class ContactCN extends cc.Component {

    onLoad() {
        let labelComp = this.node.getComponent(cc.Label);
        if (cc.sys.languageCode.indexOf('zh') != -1 && cc.sys.languageCode.indexOf('cn') != -1) {
            labelComp.string = "联系我们"
            this.node.on(cc.Node.EventType.TOUCH_END, () => {
                TFrameResLoadHelper.getInstance().getBundleAsyn("TFrameRes").then((b: cc.AssetManager.Bundle) => {
                    b.load("prefab/AboutUsDialog", cc.Prefab, (err: Error, pf: cc.Prefab) => {
                        if (err != null)
                            return console.error(err.message);
                        let dialog = cc.instantiate(pf);
                        dialog.parent = cc.Canvas.instance.node; 
                    })
                })
            })
        } else {
            labelComp.string = ""
        }
    }
}
